/**   
 * @Title: ShiyixuanwuChooseOkList.java 
 * @Package com.esun.rabbit2.viewer.mainact.lotteryhallact.shiyixuanwu 
 * @Description: 十一选五选好了的内容保存在这里
 * @Author: Miko baoz@500wan.com   
 * @Date: 2011-6-27 下午04:15:09  
 * Copyright (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.viewer.mainact.lotteryhallact.shiyixuanwu;

import java.util.ArrayList;
import java.util.Hashtable;

import com.esun.config.Config;
import com.esun.util.log.EDebug;

/**
 * @ClassName: ShiyixuanwuChooseOkList
 * @Description: 十一选五选好了的内容保存在该类中
 * @Author: Miko baoz@500wan.com
 * @Date: 2011-6-27 下午04:15:09
 * 
 */
public class ShiyixuanwuChooseOkList {

	private static ShiyixuanwuChooseOkList chooseList = null;

	public static ShiyixuanwuChooseOkList getChooseList() {

		if (chooseList == null) {
			return chooseList = new ShiyixuanwuChooseOkList();
		} else {
			return chooseList;
		}
	}

	private ArrayList<Hashtable<String, Object>> alBuying = new ArrayList<Hashtable<String, Object>>();

	public int getSize() {
		return alBuying.size();
	}

	public void add(String playStyle, String nums, int voteLine, int money , String style , String detail) {
		Hashtable<String, Object> ht = new Hashtable<String, Object>();

		ht.put(TempData.PLAY_STYLE, playStyle);
		ht.put(TempData.CODE, nums);
		ht.put(TempData.VOTE_LINE, voteLine);
		ht.put(TempData.MONEY, money);
		ht.put(TempData.STYLE, style);
		ht.put(TempData.DETAIL, detail);

		alBuying.add(ht);
	}

	public void reset() {
		alBuying = new ArrayList<Hashtable<String, Object>>();
	}

	public Hashtable<String, Object> get(int locate) {
		return alBuying.get(locate);
	}

	public void remove(int locate) {
		alBuying.remove(locate);
	}

	public void print() {
		EDebug.o(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ");
		for (int i = 0; i < getSize(); i++) {
			EDebug.o(" *************************************************************************** ");
			Hashtable<String, Object> ht = alBuying.get(i);
			EDebug.o(this, String.valueOf(ht.get(TempData.PLAY_STYLE)));
			EDebug.o(this, String.valueOf(ht.get(TempData.CODE)));
			EDebug.o(this, String.valueOf(ht.get(TempData.VOTE_LINE)));
			EDebug.o(this, String.valueOf(ht.get(TempData.MONEY)));
			EDebug.o(this, "@ [" + String.valueOf(ht.get(TempData.PLAY_STYLE)) + "]" + String.valueOf(ht.get(TempData.CODE)));
		}
		EDebug.o(" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ");
	}

	public int getVoteLine() {

		int intRet = 0;

		for (int i = 0; i < getSize(); i++) {
			intRet += Integer.parseInt(String.valueOf(alBuying.get(i).get(TempData.VOTE_LINE)));
		}
		return intRet;
	}

	public int getMoney() {
		return getVoteLine() * 2;
	}
	
	private String strDelPlayStyle= Config.NULLMARK;;
	private String strDelNum= Config.NULLMARK;;
	private String strDelVoteNum= Config.NULLMARK;;
	private String strDelVoteMoney= Config.NULLMARK;;
	public void tempDelete(String playStyle,String num,String voteInfo){
		this.strDelNum = num;
		this.strDelPlayStyle = playStyle;
		String [] strFir = voteInfo.split("注|元");
		for(int i=0;i<strFir.length;i++){
			EDebug.o(this,strFir[i]);
		}
		String[] strSec = strFir[1].split("\\ ");
		for(int i=0;i<strSec.length;i++){
			EDebug.o(this,strSec[i]);
		}
		this.strDelVoteNum = strFir[0];
		this.strDelVoteMoney = strSec[1];
	}
	
	public String getDeletePlayStyle(){
		return strDelPlayStyle;
	}
	public String getDeleteNum(){
		return strDelNum;
	}
	public String getDeleteVoteNum(){
		return strDelVoteNum;
	}
	public String getDeleteVoteMoney(){
		return strDelVoteMoney;
	}
	
	public void clearDeleteInfo(){
		strDelPlayStyle = Config.NULLMARK;
		strDelNum= Config.NULLMARK;
		strDelVoteNum= Config.NULLMARK;
		strDelVoteMoney= Config.NULLMARK;
	}

}
